package com.haoshuang.zhouzhoubang.ui.adapter


import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter4.BaseQuickAdapter
import com.haoshuang.zhouzhoubang.R
import com.haoshuang.zhouzhoubang.databinding.ItemTeamMemberList2Binding
import com.haoshuang.zhouzhoubang.model.bean.GroupBean
import com.lxj.xpopup.XPopup

import com.makeramen.roundedimageview.RoundedImageView
import com.mufeng.libs.base.BaseBindingHolder
import com.mufeng.libs.base.BaseBindingQuickAdapter
import com.mufeng.libs.utils.view.gone
import com.mufeng.libs.utils.view.load
import com.mufeng.libs.utils.view.visible


/**
 * 订单模块中的订单列表适配器
 * */
class Meger1Adapter(data: MutableList<GroupBean.AllPeople>) :
    BaseBindingQuickAdapter<GroupBean.AllPeople, ItemTeamMemberList2Binding>(data){

    override fun onBindViewHolder(
        holder: BaseBindingHolder,
        position: Int,
        item: GroupBean.AllPeople?
    ) {
        val binding = holder.getViewBinding<ItemTeamMemberList2Binding>()
        val tvName = holder.getView<TextView>(R.id.tvName)
        val tvSde = holder.getView<TextView>(R.id.tvSde)
        val textView28 = holder.getView<TextView>(R.id.textView28)
        val textView26 = holder.getView<TextView>(R.id.textView26)
        val tvTime = holder.getView<TextView>(R.id.tvTime)
        val tvService = holder.getView<TextView>(R.id.tvService)
        val ivCheck = holder.getView<ImageView>(R.id.ivCheck)
        val tvDj = holder.getView<TextView>(R.id.tvDj)

        binding.tvStatus.text = item?.is_master_status

        if (item?.isCHeck2==1){
            ivCheck.visible()
        }else{
            ivCheck.gone()
        }
        if (item?.isCHeck==1){
            ivCheck.setImageResource(R.mipmap.dz_ok)

        }else{
            ivCheck.setImageResource(R.mipmap.dz_wx)
        }
        if (item?.clock_in==2){

            textView26.visible()
            textView28.gone()
        }else{
            textView26.gone()
            textView28.visible()
        }
        if (item?.cate_name?.isNotEmpty() == true) {
            tvService.text = item!!.cate_name[0]
        }

        val roundedImageView2 = holder.getView<RoundedImageView>(R.id.roundedImageView2)
        tvName.text = item?.nickname
        tvDj.text = "冻结金额："+item?.team_freeze_money
        tvTime.text ="加入时间：${item?.add_time}"
        roundedImageView2.load(item?.avatar, R.mipmap.rl)
    }

}